package BookManagement.user;

import BookManagement.book.Bookshelf;
import BookManagement.operation.IBusinessOperation;

//设计一个登录逻辑：属性就是姓名、账号、密码；
public abstract class User {
    private String name;
    private String account;
    private String password;
    private boolean role;//false表示普通用户、true表示管理人员
    protected IBusinessOperation[] iBusinessOperations;

    public User(String name, String account, String password, boolean role) {
        this.name = name;
        this.account = account;
        this.password = password;
        this.role = role;
    }

    public abstract int menu();

    public void doOperation(int choice,Bookshelf bookshelf){
        this.iBusinessOperations[choice].work(bookshelf);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public boolean isRole() {
        return role;
    }

    public void setRole(boolean role) {
        this.role = role;
    }
}
